﻿using System.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.ObjectBuilder;

namespace Reniec.Data.Layer.Base
{
    public class ConexionSql
    {
        private static ConexionSql _Instancia;
	    public static Database _Database;
	    public static string AppConeccion = ConfigurationManager.ConnectionStrings["Reniec"].ConnectionString;
        private ConexionSql()
	    {
		    _Database = DatabaseFactory.CreateDatabase("Reniec");
	    }
	    private static object _SynClock = new object();
        public static ConexionSql Instancia()
	    {
		    if (_Instancia == null) {
			    lock ((_SynClock)) {
				    if (_Instancia == null) {
                        _Instancia = new ConexionSql();
				    }
			    }
		    }
		    return _Instancia;
	    }
	    public Database DataBase()
	    {
		    return _Database;
	    }
    }
}
